﻿@{
    ViewData["Title"] = "Home Page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
    <h4>SkiaSharp绘图</h4>
    <button class="btn btn-primary m-1" onclick="OnClickImg()" type="button">更新绘图</button>
    <a class="btn btn-info m-1" href="/Home/ExportSkiaPdf" target="_blank">导出PDF</a>
    <a class="btn btn-info m-1" href="/Home/ExportItextPdf" target="_blank">导出iText创建的PDF</a>
    <br />
    <img src="/Home/GetImg" alt="pic" class="img-thumbnail" width="600" height="300" id="imgCaptcha" onclick="OnClickImg()" title="点击图片更新" />
</div>

@section Scripts {

<script type="text/javascript">

    function OnClickImg() {
        //确保URL每秒有变化，否则浏览器不去访问服务端
        var date = new Date();
        var src = "/Home/GetImg?id=" + date.getTime();
        document.getElementById("imgCaptcha").src = src;
    }
</script>
}
